package com.study.entity;

import com.alibaba.druid.sql.visitor.functions.Char;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class Machine {
    private String name;

    private int x;

    private int y;

    private String temp;

    private int xSpeed;

    private int ySpeed;

    public Machine(String name, int x, int y,String temp) {
        this.name = name;
        this.x = x;
        this.y = y;
        this.temp =temp;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public String getTemp() {
        return temp;
    }

    public void setTemp(String temp) {
        this.temp = temp;
    }

    public int getxSpeed() {
        return xSpeed;
    }

    public void setxSpeed(int xSpeed) {
        this.xSpeed = xSpeed;
    }

    public int getySpeed() {
        return ySpeed;
    }

    public void setySpeed(int ySpeed) {
        this.ySpeed = ySpeed;
    }

    public void turnLeft(){
        switch (this.temp){
            case "N": this.temp = "E";

        }
    }

    public void go(int M){
        switch (this.temp){
            case "E":

                this.xSpeed = -M;
        }

        move();
        xSpeed = 0;
        ySpeed = 0;
    }

    private void move() {
        x+=xSpeed;
        y+=ySpeed;
    }

    public  void getContext(char c){

    }

    public static void main(String args[]){

        Machine machine = new Machine("test",1,2,"N");

        String str = "LRMMRRMM";
        char[] chars = str.toCharArray();

        for (int i = 0; i<chars.length;i++){
            machine.getContext(chars[i]);
        }
        System.out.println(machine.getX()+"   "+machine.getY());
    }
}
